fix: FilesViewModel - WPB-24805#4590
Merged
Merged
Conversation
… entity - WPB-24208 (#4478)
… Publisher with the need for manually setting up a sink
…WPB-23967-make-files-available-offline-ui-bl # Conflicts: # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesItemViewModel.swift
…WPB-23967-make-files-available-offline-ui-bl # Conflicts: # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/FilesContentView.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesItemViewModel.swift
…WPB-23967-make-files-available-offline-ui-bl
…g when deleting to the recycle bin
…WPB-23967-make-files-available-offline-ui-bl # Conflicts: # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesItemViewModel.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesViewItemView.swift
Contributor
Test Results303 tests 303 ✅ 1m 10s ⏱️ Results for commit ddb163d. ♻️ This comment has been updated with latest results. Summary: workflow run #26039042254 |
jullianm
requested changes
May 11, 2026
Contributor
jullianm
left a comment
There was a problem hiding this comment.
Nice clean up of the view model, I left a couple of feedbacks/issues specifically related to the loaders components.
# Conflicts: # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Create/CreateFileViewModel.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Rename/FileRenameViewModel.swift # WireMessaging/Tests/WireMessagingTests/WireDrive/UITests/Components/Files/FilesViewModelTests.swift
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue
The swift file FilesViewModel is almost 1k loc long, is shared by multiple Views and has accumulated a lot of code for different kinds of functionality.
This makes it hard to read and maintain it.
Solution
Many different kinds of refactoring were implemented resulting in the
FilesViewModel.swiftfile being about 50% smaller:FilesViewIteminto a separate fileSheetNavigationto use Model data instead of SwiftUI Views as payload, eliminating the need forimport SwiftUIin ViewModel codeFilesViewModel+make_ViewModels.swiftUseCasesnested struct into the extensionFilesViewModel+UseCases.swiftLoadOfflineAvailableFilesUIActionIncrementalListLoaderandFilesListLoader// MARK: labelcommentsTesting
The logic should be exactly the same after the refactoring.